<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>智联同城——小程序管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <style type="text/css">
        .layui-table{
            text-align: center;
        }
        .layui-table td, .layui-table th{
            text-align: center;
        }
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">智联同城</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item "><a href="{:U('Index/index')}">首页</a></li>
            <li class="layui-nav-item"><a href="{:U('InfoCate/index')}">分类信息管理</a></li>
            <li class="layui-nav-item"><a href="{:U('ShopCate/index')}">好店管理</a></li>
            <li class="layui-nav-item layui-this"><a href="{:U('Quan/index')}">同城圈管理</a></li>
            <li class="layui-nav-item"><a href="{:U('Member/index')}">用户管理</a></li>
            <li class="layui-nav-item"><a href="{:U('Home/Index/index')}">切换小程序</a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="{$Think.session.wechat.headimg}" class="layui-nav-img">
                    {$Think.session.wechat.nickname}
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="{:U('Home/Index/index')}">切换小程序</a></dd>
                    <!-- <dd><a href="">安全设置</a></dd> -->
                </dl>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="{$Think.session.headimgurl}" class="layui-nav-img">
                    {$Think.session.nickname}
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="{:U('Home/Public/logout')}">退出登录</a></dd>
                    <!-- <dd><a href="">安全设置</a></dd> -->
                </dl>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item "><a href="{:U('Quan/index')}">同城圈管理</a></li>
                <li class="layui-nav-item"><a href="{:U('QuanReply/index')}">回复管理</a></li>
                <li class="layui-nav-item"><a href="{:U('News/index')}">资讯管理</a></li>
                <li class="layui-nav-item"><a href="{:U('News/cate')}">资讯分类管理</a></li>
                <li class="layui-nav-item"><a href="{:U('Quan/circle')}">圈子管理</a></li>
                <li class="layui-nav-item"><a href="{:U('Zhibo/index')}">直播管理</a></li>
                <li class="layui-nav-item"><a href="{:U('Quan/gift')}">礼物价格管理</a></li>
                <li class="layui-nav-item"><a href="{:U('Quan/banner')}">轮播图管理</a></li>
                <li class="layui-nav-item"><a href="{:U('Quan/topicList')}">热门话题管理</a></li>\
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">同城卡管理</a>
                    <dl class="layui-nav-child">
                        <dd class=""><a href="{:U('Card/index')}">&nbsp;&nbsp;&nbsp;&nbsp;同城卡图片</a></dd>
                        <dd class=""><a href="{:U('Card/card')}">&nbsp;&nbsp;&nbsp;&nbsp;编辑同城卡</a></dd>
                        <dd class=""><a href="{:U('Shop/agreement_t')}">&nbsp;&nbsp;&nbsp;&nbsp;开通同城卡协议</a></dd>
                        <dd class="layui-this"><a href="{:U('Shop/agreement_shop')}">&nbsp;&nbsp;&nbsp;&nbsp;商户参与同城卡协议</a></dd>
                        <dd class=""><a href="{:U('Shop/agreement_q')}">&nbsp;&nbsp;&nbsp;&nbsp;同城卡权益管理</a></dd>
                        <dd class=""><a href="{:U('Card/examineShopCard')}">&nbsp;&nbsp;&nbsp;&nbsp;商户参与同城卡管理</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding:0 15px;">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>商户参与同城卡协议</legend>
            </fieldset>
            <div>
                <button id="add" class="layui-btn">添加协议</button>
                &nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 18px;color: orangered;">协议仅显示一条</span>
            </div>
            <table class="layui-table">
                <colgroup>
                    <col width="100">
                </colgroup>
                <thead>
                <tr>
                    <th>ID</th>
                    <th>协议名称</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="list" item="vo">
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.title}</td>
                        <td>
                            <if condition="$vo.state eq 1 ">
                                <span style="color: red;">显示</span>
                            <else />
                                <span>不显示</span>
                            </if>
                        </td>
                        <td>
                            <button data-id="{$vo.id}" data-state="{$vo.state}" class="upstate layui-btn layui-btn-small" style="background-color: #1E90FF;">更改状态</button>
                            <button data-id="{$vo.id}" class="edit layui-btn layui-btn-small">编辑</button>
                            <button data-id="{$vo.id}" class="del layui-btn layui-btn-small">删除</button>
                        </td>
                    </tr>
                </foreach>
                </tbody>
            </table>
            <!-- <div id="page-box"></div> -->
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © 2017-2018 <a href="https://www.58zltc.com" target="_blank">智联同城</a> All Rights Reserved.
    </div>
</div>
<script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
<script>
    //JavaScript代码区域
    layui.use(['element','laypage','layer'], function(){
        var element = layui.element
                ,$ = layui.jquery
                ,layer = layui.layer
                ,laypage = layui.laypage;
        $(".sub_add").click(function(event) {
            var id = $(this).data('id');
            layer.open({
                type: 2,
                title: '添加子分类',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['450px', '400px'],
                content: '{:U("sub_add")}?id='+ id
            });
        });
        $(".sub_edit").click(function(event) {
            var id = $(this).data('id');
            layer.open({
                type: 2,
                title: '编辑子分类',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['450px', '400px'],
                content: '{:U("sub_edit")}?id='+ id
            });
        });
        $("#add").click(function(event) {
            layer.open({
                type: 2,
                title: '商户参与同城卡协议',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: '{:U("add_argeement_shop")}'
            });
        });
        $(".edit").click(function(){
            var id = $(this).data('id');
            layer.open({
                type: 2,
                title: '编辑协议',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: '{:U("add_argeement_shop")}?id='+ id
            });
        });
        $(".del").click(function(){
            var id = $(this).data('id');
            $.post("{:U('del_agreement')}", {id: id}, function(e) {
                if(e.status == 1){
                    layer.msg(e.info,{icon: 6,time:1000});
                    setTimeout("location.reload()",1000);
                }else{
                    layer.msg(e.info,{icon:1,time:1000});
                }
            });
        });
        $(".upstate").click(function(){
            var id = $(this).data('id');
            var state = $(this).data('state');
            $.post("{:U('up_agreement')}", {id: id, state: state}, function(e) {
                if(e.status == 1){
                    layer.msg(e.info,{icon: 6,time:1000});
                    setTimeout("location.reload()",1000);
                }else{
                    layer.msg(e.info,{icon:1,time:1000});
                }
            });
        });
    });
</script>
</body>
</html>
